<?php
/**
 * Created by PhpStorm.
 * User: zhou
 * Date: 2019/3/26
 * Time: 上午12:26
 */

namespace App\Models;


use Illuminate\Database\Eloquent\Model;

class HotelOwner extends Model
{
    protected $table = 'hotel_owners';


    public static function getOwnerByHotelId($hotel_id)
    {
        $model = HotelOwnerApply::query()
            ->select('ho.id AS hotel_owner_id','ho.open_id')
            ->join('hotel_owners AS ho','ho.open_id','=','hotel_owners_apply.open_id')
            ->where('hotel_id','=',$hotel_id)
            ->where('status','=',1)
            ->first();
        return empty($model) ? false : $model;
    }

}